﻿<%@ Page Language="C#"  MasterPageFile="~/App_form/Menu/dao_tao.master" AutoEventWireup="true" CodeFile="Dang_ky.aspx.cs" Inherits="App_form_KTX_Dang_ky" %>

<%@ Register TagPrefix="Control" TagName="menu_phai" Src="~/App_ctr/Admin/menu_phai.ascx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div style="width: 100%">
        <div style="width: 20%; float: left;">
            <Control:menu_phai runat="server" ID="menuphai" />
        </div>
        <div style="width: 79.4%; float: right;">
            <div style="background-image: url(../../CSS/images/ui-bg_glass_75_e6e6e6_1x400.png); font-weight: bold; height: 30px; border: 1px solid #d3d3d3; margin-top: 4px; text-align: center; padding-top: 8px; text-transform: uppercase;">
                Đăng ký phòng kí túc xá
            </div>
            <div id="ndung" style="padding: 20px; margin-top: 2px;">
                <div style="display: table; margin: 0 auto; width:100%; border: 1px solid #d3d3d3; font-size: 16px;">
                    <div style="background-image: url(../../Images/Hethong/back.gif); background-repeat: repeat-x; height: 30px; font-size: 12px !important;"></div>
                    <div style="padding: 20px;">
                        <div id="ndung_ct" class="clearfix">
                            <div style="width: 52%; float: left; margin-top: 90px;">
                                <div style="float: left; width: 30%;">
                                    <label>
                                        Nhà / Dãy  :
                                    </label>
                                </div>
                                <div>
                                    <Lib:drop runat="server" CssClass="combo panel" ID="NHA" Height="25px" Width="280px" 
                                    DataTextField="TEN" DataValueField="MA" 
                                    onClientChange="P_NHA_CHANG()" />
                                </div>
                                <div style="width: 100%; height: 6px;"></div>
                                <div style="float: left; width: 30%;">
                                    <label>
                                        Phòng :
                                    </label>
                                </div>
                                <div>
                                    <Lib:drop runat="server" CssClass="combo panel" ID="PHONG" Height="25px" Width="280px" 
                                    DataTextField="TEN" DataValueField="MA" 
                                    onClientChange="P_PHONG_CHANG()" />
                                </div>
                                <div style="width: 100%; height: 6px;"></div>
                                <div style="float: left; width: 30%;">
                                    <label>
                                        Mã sinh viên
                                    </label>
                                </div>
                                <div>
                                    <Lib:textBox runat="server" ID="MASV" Width="280px" Msg="Mã sinh viên" />
                                </div>
                            </div>
                            <div style="width: 40%; float: left;">
                                <Lib:gridView runat="server" ID="lke_dk" Width="480" Height="300" onClientCellClick="PHONG_CELL_CLICK">                                
                                    <Columns>
<%--                                        <Lib:Column Hidden="true" BaseColumn="MA" Name="MA" Width="120" />--%>
                                        <Lib:Column BaseColumn="TenPhong" Name="Phòng" Width="120" />
                                        <Lib:Column BaseColumn="MA_SV" Name="Mã sv" Width="120" />
                                        <Lib:Column BaseColumn="HOVATEN" Name="Họ tên" Width="120" />
                                         <Lib:Column BaseColumn="NGAY_DK" Name="Ngày đk" Width="120" />
                                    </Columns>
                                    <Pager>
                                        <Lib:Pager PageSize="10" />
                                    </Pager>
                                </Lib:gridView>
                            </div>
                        </div>
                        <div style="width: 100%; height: 30px;"></div>
                        <div style="margin-left: 100px;">
                            <Lib:Button runat="server" ID="add" Text="Lưu" Width="100px" onClientClick="P_PHONG_NH()"></Lib:Button>
                            <Lib:Button runat="server" ID="new" Text="Mới" Width="100px" onClientClick="P_PHONG_MOI()"></Lib:Button>
                            <Lib:Button runat="server" ID="del" Text="Trả phòng" Width="100px" onClientClick="P_PHONG_XOA()"></Lib:Button>
                        </div>
                    </div>
                </div>
            </div>
         </div>
</div>
<asp:HiddenField runat="server" ID="ma1" Value="0" />
<script type="text/javascript">
        function P_NHA_CHANG() {
            try {
                var nha = $("#<%=NHA.ClientID%>").val();
                if (nha == "")
                    return;
                wht_nsd.FKTX_PHONG_LKE(nha, P_PHONG_LKE_KQ, ErrorDb, ErrorTimeOut);
            }
            catch (e) {
                ShowError(e.message);
            }
        }
        function P_PHONG_LKE_KQ(b_kq) {
            if (CheckError(b_kq)) {
                ShowError(b_kq);
                return;
            }
            var phong = "<%=PHONG.ClientID%>";
            var a = GetDropByID(phong);
            a.dataBin(b_kq);
            P_PHONG_CHANG();
            // $("#<%=MASV.ClientID%>").focus();
        }
        function P_PHONG_CHANG() {
            try {
                var phong = $("#<%=PHONG.ClientID%>").val();
                if (phong == "")
                    return;
                wht_nsd.FKTX_DANGKY_LKE(phong, P_DKY_LKE_KQ, ErrorDb, ErrorTimeOut);
            }
            catch (e) {
                ShowError(e.message);
            }
        }
        function P_DKY_LKE_KQ(b_kq) {
            if (CheckError(b_kq)) {
                ShowError(b_kq);
                return;
            }
            P_PHONG_MOI();
            var grid = GetGridByID("<%=lke_dk.ClientID%>");
            grid.dataBin(b_kq);
        }
        function P_PHONG_MOI() {
            ResetForm("ndung_ct");
            $("#<%=ma1.ClientID%>").val("0");
            $("#<%=MASV.ClientID%>").focus();
        } 
        </script>
</asp:Content>